<?php


/**
 * 留言管理
 * Enter description here ...
 * @author Admin
 *
 */
class MessageAction extends CommonAction{

	
	/**
	 * 
	 * Enter description here ...
	 */
    public function index()   {
    	$message = D('Message');
    	$map['state'] = array('eq',1);
    	
		$user = $_SESSION['user'];   //用户信息
		if(!empty($user)){      //获取当前用户留言或者管理员通过审核的留言（其他用户）
			$map['_logic'] = 'or';
			$map['uid'] = array('eq',$user['id']);
		}
		
    	$count = $message->getCount($map);
    	
    	$limit = $this->page($count,20);
    	
    	$messagedata = $message->getdata($map,$limit);
    	
    	$this->assign('messagedata',$messagedata);
    	
        $this->display();
    }
    
    
    
    
}
?>